package com.qunar.tech.team12.shell.processer;

import com.qunar.tech.team12.shell.command.Command;
import com.qunar.tech.team12.shell.command.CommandParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * Created by mzy on 14-7-23.
 */
public class Processer {

    private static Logger LOG = LoggerFactory.getLogger(Processer.class);

    public static void process(String str) {
        List<Command> commands = CommandParser.parse(str);
        for (Command cmd : commands) {
            try {
                cmd.execute();
            } catch (Exception e) {
                LOG.error("{}",e.getMessage());
            }
        }
    }
}
